#ifndef CANCLIENT_H
#define CANCLIENT_H

#include <QTime>
#include <QTimer>
#include <QDebug>
#include <QObject>
#include <QLibrary>
#include <QDataStream>
#include <QElapsedTimer>
#include <unistd.h>
#ifdef __arm__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <linux/can.h>
#include <linux/can/raw.h>
#include <linux/netlink.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <netinet/in.h>
#include <net/if.h>
#include <fcntl.h>
#include <sys/un.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <arpa/inet.h>
#endif

#include "ICANCmd.h"

class CanClient : public QObject
{
    Q_OBJECT
public:
    explicit CanClient(QObject *parent = 0);

signals:
    void GetCanData(QByteArray msg);
private slots:
    void DeviceOpen(void);
    void DeviceQuit(void);
    bool DeviceSend(void);
    bool DeviceRead(void);
    void WriteAll(QByteArray msg);
    void readAll(void);
private:
    int s;
    QTimer *timer;
#ifdef __arm__
    can_frame  TxMsg;
#else
    tagCAN_DataFrame TxMsg;
#endif
};

#endif // CANCLIENT_H
